package org.spa.modules.demo.service.impl;

import org.spa.common.api.vo.Result;
import org.spa.modules.demo.entity.TestTabel;
import org.spa.modules.demo.mapper.TestTabelMapper;
import org.spa.modules.demo.service.TestTabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



/**
 * 描述: 
 * author: P0081447
 * date: 2022-03-27 15:32:13
 */
@Service
public class TestTabelServiceImpl implements TestTabelService {

    @Autowired
	private TestTabelMapper testTabelMapper;
	
	/**
	 * 添加
	 *
	 * @param testTabel
	 * @return
	 */
	@Transactional
	public Result<?> insert(TestTabel testTabel) {
//	    testTabel.setId(null);
	    testTabelMapper.insert(testTabel);
	    return Result.resultOK("添加成功！");
	}
	
	/**
	 * 编辑
	 *
	 * @param testTabel
	 * @return
	 */
	@Transactional
	public Result<?> updateById(TestTabel testTabel) {
	    testTabelMapper.updateById(testTabel);
	    return Result.resultOK("编辑成功!");
	}
	
	/**
	 * 通过id删除
	 *
	 * @param id
	 * @return
	 */
	@Transactional
	public Result<?> deleteById(int id) {
	    testTabelMapper.deleteById(id);
	    return Result.resultOK("删除成功!");
	}
	
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	public Result<?> selectById(int id) {
	    TestTabel testTabel = testTabelMapper.selectById(id);
	    return Result.resultOK(testTabel);
	}
}